<!--Descriptive page name, messages and instructions-->
<h2>Listing translations: <%= @main_locale.name %> to <%= @locale.name %></h2>
<!--/descriptions-->

<!--subnav-->
<% if logged_in_as_admin? || current_user.is_translation_admin? %>
<ul class="navigation admin">
	<li><%= link_to 'Add a new language', new_language_path %></li>
	<li><%= link_to 'Add a new locale', new_locale_path %></li>
	<li><%= link_to 'Add new translators', new_translator_path %></li>
</ul>
<% end %> <!--need to combine these two navs-->

<% unless logged_in_as_admin? %>
<p>View translations assigned to me as: 
  <%= link_to 'Translator', translator_translations_path(current_user) %> | 
  <%= link_to 'Beta', translator_translations_path(current_user, :show => 'beta') %>
</p>
<% end %>
<!--/subnav-->

<!--main content--><!--INVESTIGATE. INVALID-->
<%= form_tag(@path_for_filtering || translations_path, :method => :get) do %>
  <p><%= label_tag 'status', t('.filter_by_status', :default => 'Filter by status:') %></p>
  <p><%= select_tag 'status', options_for_select(@status_list, @current_status) %></p> 
  <p><%= label_tag 'namespace', t('.filter_by_namespace', :default => 'Filter by namespace:') %></p>
  <p><%= select_tag 'namespace', options_for_select(@namespaces, @current_namespace) %></p> 
  <p><%= submit_tag t('.filter_translations', :default => 'Filter translations') %></p>  
<% end %>

<% @translations.group_by(&:namespace).each do |namespace, translations| %>

<div class='namespace'>
  <h2><%=h namespace %></h3> <span class='notes-links'><%= namespace_notes(namespace) %></span>
  <% if logged_in_as_admin? || current_user.is_translation_admin? %>
    <%= form_tag(assign_translations_path(:namespace => namespace), :method => :post) do %>
      <h3>Assign entire namespace</h3>
      <span>Translator: <%= collection_select :translator, :id, @translators, :id, :login, :include_blank => true %></span>
      <span>Beta: <%= collection_select :beta, :id, @translators, :id, :login, :include_blank => true %></span>
      <span><%= submit_tag t('.assign_translations', :default => 'Assign') %></span>
    <% end %>  
  <% end %>  
</div>
  
  <% #this is obviously less than ideal %>
  <% for translation in translations %>
    <% if !translation.locale.main? %>
      <% local_translation = translation %>
      <% translation = local_translation.counterpart_in_main || local_translation %>
    <% else %>
      <% local_translation = translation.counterpart_in(@locale) %>
    <% end %>
    <div class='translation' id="translation_<%= local_translation.id %>">
      <%= render :partial => 'translation', :locals => {:translation => translation, :local_translation => local_translation} %>
    </div> 
  <% end %>
  
<% end %>
<!--/content-->

<!--subnav-->
<%= will_paginate @translations, :previous_label =>  "&laquo; " + t('.pagination.previous', :default => "Previous"), :next_label => t('.pagination.next', :default => "Next") + " &raquo;" %>
<!--/subnav-->